export class BitFieldUtil {
  static has(value: number, bit: number): boolean {
    return (value & bit) === bit
  }

  static hasAny(value: number, bits: number): boolean {
    return (value & bits) !== 0
  }

  static equals(value: number, bits: number): boolean {
    return value === bits
  }

  static missing(value: number, bits: number): number {
    const has = value & (~(0 | (bits)))
    return value & (~(0 | has))
  }
}